﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<link rel="stylesheet" href="../lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>生产报表</title>
</head>
<body class="pos-r">
<div style="margin-left:5px;">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 生产报表 <span class="c-gray en">&gt;</span> 猪群饲养成本 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="text-c"> 
			<input type="text" name="" id="gname" placeholder=" 猪舍号" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit" onclick="getPigCostByGname()"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
				<button name="" id="" class="btn btn-success" onClick ="tableExport('table')"><i class="Hui-iconfont">&#xe644;</i> 导出</button> 
			<button name="" id="print" class="btn btn-success" onClick="print()"><i class="Hui-iconfont">&#xe652;</i> 打印</button>
		</div>
		<div class="mt-20">
			<table id="table" class="table table-border table-bordered table-bg table-hover table-sort">
				<!--  <thead>
					<tr class="text-c">
						<th width="40">舍号</th>
						<th width="40">期初存栏</th>
						<th width="40">期末存栏</th>
						<th width="40">饲养头数</th>
						<th width="40">平均头数</th>
						<th width="40">饲料成本</th>
						<th width="40">疫苗药品成本</th>

						<th width="40">其他成本</th>
						<th width="40">合计成本</th>

					</tr>
				</thead>
				<tbody>
					<tr class="text-c va-m">
						<td>dd-1</td>
						<td>389</td>
						<td>389</td>
						<td>100.00</td>
						<td>389</td>
						<td>100.00</td>
						<td>40.00</td>
						<td>3667.0</td>
	
						<td>40.00</td>
					</tr>
				</tbody>
				-->
			</table>
			<div class="foot">
				 <a href="javascript:void(0)" id="before" class="pages" >上一页</a> 
				 <a id="recordall" class="word">0 条记录</a> <a id="pagecount" class="word"> 0/0页</a>
				 <a href="javascript:void(0)" id="after" class="pages" >下一页</a>&nbsp; &nbsp;
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="../static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
 <script type="text/javascript" src="../js/jQuery.print.js"></script> 
<script type="text/javascript" src="../js/leadout.js"></script>  
<script type="text/javascript">
function print(){
	$.print("#table");
}
$(function(){
	$.post("../pcost.do",{"v":"query"},function(data){
		
		$("#recordall").html(data.recordall+"条记录");
		$("#pagecount").html(data.page+"/"+data.pageCount+"页");
		$("#before").attr("href","javascript:pagination("+(data.page-1)+")");
		$("#after").attr("href","javascript:pagination("+(parseInt(data.page)+1)+")");
		var html="<thead><tr class='text-c'>"
			html +="<th width=\"40\">舍号</th>"
				html +="<th width=\"40\">期初存栏</th>"
				html +="<th width=\"40\">期末存栏</th>"
				html +="<th width=\"40\">饲养头数</th>"
				html +="<th width=\"40\">平均头数</th>"
				html +="<th width=\"40\">饲料成本</th>"
				html +="<th width=\"40\">疫苗药品成本</th>"
				html +="<th width=\"40\">其他成本</th>"
				html +="<th width=\"40\">成本合计</th>"
				html +="</tr></thead>";
				$.each(data.list,function(i,v){
					 html +='<tbody><tr class="text-c va-m"><td>'+v.gra_name+'</td>';
					  html +='<td>'+v.classes+'</td>';
					  html +='<td>'+v.classes+'</td>';
					  html +='<td>'+v.blcount+'</td>';
					  html +='<td>'+v.avgs+'</td>';
					  html +='<td>'+v.fcost+'</td>';
					  html +='<td>'+v.mcost+'</td>';
					  html +='<td>'+v.other+'</td>';
					  html +='<td>'+v.allcost +'</td></tr></tbody>';
				});
				$("#table").html(html);
	},"json");
})

//查询
function getPigCostByGname(){
	var gname = $("#gname").val()
		$(".foot").hide();
		$.post("../pcost.do",{"v":"getPigCostByGname","gname":gname},function(data){
			if(data==null||data==""){
				alert("输入有误，请重新输入！")
				$("#gname").val("").focus();
			}else{
			var html="<thead><tr class='text-c'>"
				html +="<th width=\"40\">舍号</th>"
					html +="<th width=\"40\">期初存栏</th>"
					html +="<th width=\"40\">期末存栏</th>"
					html +="<th width=\"40\">饲养头数</th>"
					html +="<th width=\"40\">平均头数</th>"
					html +="<th width=\"40\">饲料成本</th>"
					html +="<th width=\"40\">疫苗药品成本</th>"
					html +="<th width=\"40\">其他成本</th>"
					html +="<th width=\"40\">成本合计</th>"
					html +="</tr></thead>";
						 html +='<tbody><tr class="text-c va-m"><td>'+data.gra_name+'</td>';
						  html +='<td>'+data.classes+'</td>';
						  html +='<td>'+data.classes+'</td>';
						  html +='<td>'+data.blcount+'</td>';
						  html +='<td>'+data.avgs+'</td>';
						  html +='<td>'+data.fcost+'</td>';
						  html +='<td>'+data.mcost+'</td>';
						  html +='<td>'+data.other+'</td>';
						  html +='<td>'+data.allcost +'</td></tr></tbody>';
			$("#table").html(html);
			}
		},"json");
	}
	
	


//分页
function pagination(obj){
	$.post("../pcost.do",{"v":"query","page":obj},function(data){
		$("#recordall").html(data.recordall+"条记录");
		$("#pagecount").html(data.page+"/"+data.pageCount+"页");
		$("#before").attr("href","javascript:pagination("+(data.page-1)+")");
		$("#after").attr("href","javascript:pagination("+(parseInt(data.page)+1)+")");
		var html="<thead><tr class='text-c'>"
			html +="<th width=\"40\">舍号</th>"
				html +="<th width=\"40\">期初存栏</th>"
				html +="<th width=\"40\">期末存栏</th>"
				html +="<th width=\"40\">饲养头数</th>"
				html +="<th width=\"40\">平均头数</th>"
				html +="<th width=\"40\">饲料成本</th>"
				html +="<th width=\"40\">疫苗药品成本</th>"
				html +="<th width=\"40\">其他成本</th>"
				html +="<th width=\"40\">成本合计</th>"
				html +="</tr></thead>";
				$.each(data.list,function(i,v){
					 html +='<tbody><tr class="text-c va-m"><td>'+v.gra_name+'</td>';
					  html +='<td>'+v.classes+'</td>';
					  html +='<td>'+v.classes+'</td>';
					  html +='<td>'+v.blcount+'</td>';
					  html +='<td>'+v.avgs+'</td>';
					  html +='<td>'+v.fcost+'</td>';
					  html +='<td>'+v.mcost+'</td>';
					  html +='<td>'+v.other+'</td>';
					  html +='<td>'+v.allcost +'</td></tr></tbody>';
				});
				$("#table").html(html);
	},"json");
}
/*	
var code;
		
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}

$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,5]}// 制定列不参与排序
	]
});
*/
</script>
</body>
</html>